package d3_interface_demo;

import java.util.ArrayList;

public class StudentOperatorImpl1 implements StudentOperator{
    @Override
    public void printAllInfo(ArrayList<Student> students){
        System.out.println("打印全部学生信息");
      for (int i = 0; i < students.size(); i++) {
          Student s = students.get(i);
          System.out.println("name:"+s.getName() + " sex:" + s.getSex() + " grade:" + s.getScore());
      }
    }

    @Override
    public void printAverageScore(ArrayList<Student> students){
      double allscore = 0.0;
      for (int i = 0; i < students.size(); i++) {
          Student s = students.get(i);
          allscore += s.getScore();
      }

      System.out.println("All Score:" + allscore);
    }
}
